package top.zhangjianyong.tools.factory;

import top.zhangjianyong.tools.entity.TransactionOrder;
import top.zhangjianyong.tools.parm.TransactionOrderAddParm;
import top.zhangjianyong.tools.parm.TransactionOrderUpdateParm;

/**
 * @author ： zhangjianyong
 * @date ： 2022/4/25 2:14 下午
 */
public class TransactionOrderFactory {

    public static  TransactionOrder create() {
        return new TransactionOrder();
    }
    public static TransactionOrder create(Long id){
        TransactionOrder transactionOrder = create();
        transactionOrder.setId(id);
        return transactionOrder;
    }

    public static TransactionOrder create(TransactionOrderAddParm transactionOrderAddParm) {
        TransactionOrder transactionOrder = create();
        transactionOrder.setDate(transactionOrderAddParm.getDate());
        transactionOrder.setAmt(transactionOrderAddParm.getAmt());
        transactionOrder.setType(transactionOrderAddParm.getType());
        transactionOrder.setRemark(transactionOrderAddParm.getRemark());

        return transactionOrder;
    }
    public static  TransactionOrder create(Long id, TransactionOrderUpdateParm transactionOrderUpdateParm) {
        TransactionOrder transactionOrder = create(id);
        transactionOrder.setDate(transactionOrderUpdateParm.getDate());
        transactionOrder.setAmt(transactionOrderUpdateParm.getAmt());
        transactionOrder.setType(transactionOrderUpdateParm.getType());
        transactionOrder.setRemark(transactionOrderUpdateParm.getRemark());
        return transactionOrder;
    }

}
